package com.atguigu.jxc.service.impl;

import com.atguigu.jxc.dao.CustomerDao;
import com.atguigu.jxc.entity.Customer;
import com.atguigu.jxc.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CustomerServiceImpl implements CustomerService {

    @Autowired
    private CustomerDao customerDao;

    @Override
    public List<Customer> getCustomerList(Integer page, Integer rows, String customerName) {
        page = (page - 1) * rows;
        return customerDao.getCustomerList(page,rows,customerName);
    }

    @Override
    public Integer getCustomerTotal() {
        return customerDao.getCustomerTotal();
    }

    @Override
    public int save(Customer customer) {
        return customerDao.save(customer);
    }

    @Override
    public Customer getInfoById(String customerId) {
        return customerDao.getInfoById(customerId);
    }

    @Override
    public int updateById(Customer customer) {
        return customerDao.updateById(customer);
    }

    @Override
    public int deleteById(String customerId) {
        return customerDao.deleteById(customerId);
    }
}
